"use strict";
var commonSwiperJS, basicCostSwiper, nCurrentSlide = 0, hostUrl = "https://saas-apis.mumway.com", allWebSite = [{
    region: "华北",
    list: [{store_name: "北京——总店", address: "北京市朝阳区北苑路170号凯旋城D座（5号楼）4层"}, {
        store_name: "北京——石景山分店",
        address: "北京市石景山区老古城前街1号中海金鑫阁4号楼7层"
    }, {store_name: "北京——朝阳分店", address: "北京市朝阳区广渠路3号竞园艺术中心商三"}, {
        store_name: "北京——丰台分店",
        address: "北京市丰台区草桥欣园二区九号楼C座3层"
    }, {store_name: "天津——南开区分店", address: "天津市南开区海光寺南京路349号新天地大厦20楼"}, {
        store_name: "河北——石家庄分店",
        address: "河北省石家庄市长安区建设北大街富邦大大厦三层西门"
    }, {store_name: "河北——邯郸市分店", address: "河北省邯郸市丛台区滏东北大街289号三龙大厦B座19层"}, {
        store_name: "山西——太原市分店",
        address: "山西省太原市小店区体育路亲贤街交叉口阳光大厦14层"
    }]
}, {
    region: "华东",
    list: [{store_name: "山东——青岛市北区分店", address: "山东省青岛市市北区辽源路305号鼎都商务楼4号楼2层"}, {
        store_name: "山东——青岛市城阳区分店",
        address: "山东省青岛市城阳区正阳中路国际商务港3楼"
    }, {store_name: "安徽——合肥市分店", address: "安徽省合肥市庐阳区长江中路319号仁和大厦16楼"}, {
        store_name: "福建——福州市分店",
        address: "福建省福州市鼓楼区八一七北路88号东百大厦A座1318"
    }, {store_name: "浙江——杭州市下城区分店", address: "浙江省杭州市下城区凤起路96号之俊大厦27楼"}, {
        store_name: "浙江——杭州市西湖区分店",
        address: "浙江省杭州市西湖区西溪银泰城1号楼10楼"
    }, {store_name: "福建——厦门市分店", address: "福建省厦门市思明区嘉禾路23号新景中心写字楼B座21层"}, {
        store_name: "江苏——苏州市分店",
        address: "江苏省苏州市姑苏区广济南路19号西城永捷生活广场8层"
    }, {store_name: "江苏——南京市分店", address: "江苏省南京市鼓楼区江中北路305号12B滨江广场14楼"}, {
        store_name: "江西——南昌市分店",
        address: "江西省南昌市红谷滩新区红谷中大道1368号鼎峰中央A座5层"
    }, {store_name: "江苏——无锡市分店", address: "江苏省无锡市梁溪区吉祥大厦4层"}, {
        store_name: "上海——徐汇区分店",
        address: "上海市徐汇区漕溪北路595号上海电影集团C座8层"
    }, {store_name: "浙江——温州市分店", address: "浙江省温州市鹿城区牛山北路仁信大厦9层"}, {
        store_name: "浙江——常州市分店",
        address: "浙江省常州市天宁区金百国际商业广场6栋西座10楼"
    }, {store_name: "浙江——宁波市分店", address: "浙江省宁波市鄞州区中兴路775号天润商座B座6楼"}]
}, {
    region: "华中",
    list: [{store_name: "湖北——武汉市江汉区分店", address: "湖北省武汉市江汉区解放大道374号崇光sogo写字楼A座1702室"}, {
        store_name: "湖北——武汉市洪山区分店",
        address: "湖北省武汉市洪山区欢乐大道1号德成国贸中心B栋30层"
    }, {store_name: "河南——郑州市分店", address: "河南省郑州市管城回族区紫荆山路59号裕鸿国际C座15楼"}, {
        store_name: "湖南——长沙市分店",
        address: "湖南省长沙市开福区芙蓉中路一段319号绿地中心T1栋2803室"
    }]
}, {
    region: "华南",
    list: [{store_name: "广州——广州市天河区分店", address: "广东省广州市天河区猎德大道48号之三尚东美御1803"}, {
        store_name: "广州——广州市白云区分店",
        address: "广东省广州市白云区机场路31号之一三元里中心8楼"
    }, {store_name: "广东——深圳市分店", address: "广东省深圳市福田区天安创新科技广场A座301"}, {
        store_name: "广东——东莞市分店",
        address: "广东省东莞市东城区金泽花园商住中心玉兰阁2楼A2-A8"
    }, {store_name: "广西——南宁市分店", address: "广西省南宁市青秀区金湖路26-1号东方国际商务港A座9层"}, {
        store_name: "广西——柳州市分店",
        address: "广西省柳州市柳南区航生路32号冠宇金都3层-A8"
    }]
}, {
    region: "东北",
    list: [{store_name: "辽宁——沈阳市分店", address: "辽宁省沈阳市沈河区十一纬路169号富中大厦5层"}, {
        store_name: "黑龙江——哈尔滨市分店",
        address: "黑龙江省哈尔滨市香坊区中山路172号常青国际大厦19楼"
    }, {store_name: "吉林——长春市分店", address: "吉林省长春市南关区南湖大路1999号南湖假日酒店盛京银行2楼"}, {
        store_name: "辽宁——大连市分店",
        address: "辽宁省大连市中山区友好路158号友好大厦4层-A8"
    }]
}, {
    region: "西北",
    list: [{store_name: "陕西——西安市雁塔区分店", address: "陕西省西安市雁塔区唐延路旺座国际城C座30层"}, {
        store_name: "陕西——西安市未央区分店",
        address: "陕西省西安市未央区未央路164号西双威迎宾广场9号楼商铺3层"
    }]
}, {
    region: "西南",
    list: [{store_name: "四川——成都市锦江区分店", address: "四川省成都市锦江区东大街牛王庙段成都商会大厦B座9层"}, {
        store_name: "四川——成都市高新区分店",
        address: "四川省成都市高新区天府三街218号附32号峰汇中心1号楼3楼"
    }, {store_name: "云南——昆明市五华区分店", address: "云南省昆明市五华区青年路389号志远大厦24楼B座"}, {
        store_name: "云南——昆明市西山区分店",
        address: "云南省昆明市西山区滇池印象国际花园49-A栋别墅-A8"
    }, {store_name: "重庆——江北区分店", address: "重庆市江北区观音桥建新北路一支路6号未来国际10层"}, {
        store_name: "贵州——贵阳市分店",
        address: "贵州省贵阳市云岩区中华北路184号天毅大厦19楼"
    }]
}], evaluateArr = [{
    type: "yuesao",
    list: [{label: "金牌月嫂", name: "anyaidea", desc: "宝宝出生第一天，一家人在医院束手无策，胡阿姨的出现解决了所有的问题。"}, {
        label: "金牌月嫂",
        name: "马哥不姓马",
        desc: "赵阿姨照顾孩子有耐心又细心，干活勤快利落帮我解决了很多问题，还变着花样给我做营养汤。"
    }, {label: "金牌月嫂", name: "齐齐", desc: "高阿姨很负责任，带娃娃很细心、工作能力强月子餐也很丰富、总之很满意的月子。"}]
}, {
    type: "yuesao",
    list: [{label: "金牌月嫂", name: "anyaidea", desc: "宝宝出生第一天，一家人在医院束手无策，胡阿姨的出现解决了所有的问题。"}, {
        label: "金牌月嫂",
        name: "马哥不姓马",
        desc: "赵阿姨照顾孩子有耐心又细心，干活勤快利落帮我解决了很多问题，还变着花样给我做营养汤。"
    }, {label: "金牌月嫂", name: "齐齐", desc: "高阿姨很负责任，带娃娃很细心、工作能力强月子餐也很丰富、总之很满意的月子。"}]
}], common = {
    baseurl: $("footer").attr("host"), init: function () {
        this.fLocalHost(), this.bind(), this.fGetThisCity(), this.fChangeCity(), this.fSingleRotation(), this.fLocationClick(), this.fTabSwitch(), this.fWebSite("华北"), this.fNationalSite(), this.fProblemTab(), this.fProblemLeftTab()
    }, getQueryVariable: function (e) {
        for (var s = window.location.search.substring(1).split("&"), t = 0; t < s.length; t++) {
            var o = s[t].split("=");
            if (o[0] == e) return o[1]
        }
        return !1
    }, bind: function () {
        var e = this;
        $(".jsPopupBox").on("click", ".jsClose", function () {
            $(".jsPopupBox").hide(), $(".jsPhone").val(""), $(".jsErrorMsg").html("")
        }), 0 == localStorage.getItem("isShowDown") ? ($(".jsDownLoadBox .jsClose, .jsDownLoadBox .sus_max").hide(), $(".jsDownLoadBox .sus_min").show()) : $(".jsDownLoadBox .jsClose, .jsDownLoadBox .sus_max").show(), $(".jsDownClose").click(function () {
            $(this).hide(800), $(".jsDownLoadBox .sus_max").hide(800), setTimeout(function () {
                $(".jsDownLoadBox .sus_min").show()
            }, 800), localStorage.setItem("isShowDown", 0)
        }), $(".jsDownLoadBox").on("click", ".sus_min", function () {
            setTimeout(function () {
                $(".jsDownClose").show(800), $(".jsDownLoadBox .sus_max").show(800)
            }, 300), $(".jsDownLoadBox .sus_min").hide(200), localStorage.setItem("isShowDown", 1)
        }), $(".jsFreeConsult").on("click", function () {
            e.fFreeConsult()
        }), $(".jsAddServiceSucc").on("click", ".jsClose", function () {
            window.location.reload()
        }), $(".fix_ul a").on("mouseover", function () {
            $(".fix_ul a.cur").removeClass("cur"), $(this).addClass("cur")
        }), $(".jsScrollTop").on("click", function () {
            $("body,html").animate({scrollTop: 0}, 600)
        }), $(document).scroll(function () {
            var e = $(document).scrollTop();
            10 < e && ($(".header__nav").addClass("header__fixed"), $("section").addClass("mt100")), 0 == e && ($(".header__nav").removeClass("header__fixed"), $("section").removeClass("mt100"))
        })
    }, fLocalHost: function () {
        window.location.host;
        $("footer").attr("host", "https://saas-apis.mumway.com")
    }, fGetThisCity: function () {
        var t = this, e = localStorage.getItem("city");
        e ? ($(".showCity").html(e), this.fGetCity()) : ($(".showCity").html("定位中"), (new BMap.Geolocation).getCurrentPosition(function (e) {
            var s = e.address.city, e = (e.address.province, s.replace(/市/, ""));
            localStorage.setItem("city", s), $(".showCity").html(e), t.fGetCity()
        }))
    }, fChangeCity: function () {
        $(".jsChangeCity").on("click", ".changeCity", function () {
            $(this).next(".allcity").show()
        }), $(".allcity").mouseover(function () {
            $(this).show()
        }), $(".allcity").mouseout(function () {
            $(this).hide()
        });
        var e = localStorage.getItem("city"), s = localStorage.getItem("cityIndex");
        e && ($(".showCity").html(e), $(".allcity li.active").removeClass("active"), $(".allcity li").eq(s).addClass("active")), localStorage.getItem("cityCode") || localStorage.setItem("cityCode", ""), $(".allcity").on("click", "li", function () {
            $(".allcity li").removeClass("active"), $(this).addClass("active");
            var e = $(this).html(), s = $(this).index();
            localStorage.setItem("city", e), localStorage.setItem("cityIndex", s);
            s = $(this).data("code");
            localStorage.setItem("cityCode", s), $(".showCity").html(e), $(".allcity").hide(), commonSwiperJS.fGetChannelId()
        })
    }, fGetCity: function () {
        var i = localStorage.getItem("city"), a = localStorage.getItem("cityCode");
        $.ajax({
            type: "GET",
            headers: {"X-AUTH-APPID": "s3005"},
            url: hostUrl + "/api/merchant/v1/city_list/",
            success: function (e) {
                for (var s = e.data || [], t = "", o = 0; o < s.length; o++) t += '<li class="f14" data-code='.concat(s[o].code, ">").concat(s[o].city, "</li>"), i && !a && s[o].city == i && localStorage.setItem("cityCode", s[o].code);
                $(".allcity ul").html(t), commonSwiperJS && commonSwiperJS.fGetChannelId()
            }
        })
    }, fDemandType: function () {
        $.get(this.baseurl + "/news/v1/newsneed", function (e) {
            for (var s = e.data || [], t = "", o = 0; o < s.length; o++) t += '<option value="'.concat(s[o].id, '">').concat(s[o].desc, "</option>");
            $(".jsDemandType").html(t)
        })
    }, fSingleRotation: function () {
        new Swiper("#feedBackList", {
            loop: !0,
            speed: 300,
            slidesPerView: 3,
            spaceBetween: 0,
            centeredSlides: !0,
            watchSlidesProgress: !0,
            on: {
                setTranslate: function () {
                    for (var e = this.slides, s = 0; s < e.length; s++) {
                        var t = e.eq(s);
                        e[s].progress;
                        t.css({opacity: "", background: ""}), t.transform("")
                    }
                }, setTransition: function (e) {
                    for (var s = 0; s < this.slides.length; s++) this.slides.eq(s).transition(e)
                }
            },
            navigation: {nextEl: ".swiper-button-next", prevEl: ".swiper-button-prev"}
        })
    }, fMultipleRotation: function (e) {
        var s = $("#basicCostList .swiper-slide"), t = s.length - 1;
        (nCurrentSlide += e) < 0 && (nCurrentSlide = t), t < nCurrentSlide && (nCurrentSlide = 0);
        e = nCurrentSlide;
        s.removeClass("swiper_slide_left swiper_slide_active swiper_slide_right"), s.eq(e).addClass("swiper_slide_active"), s.eq(0 !== e ? e - 1 : t).addClass("swiper_slide_left"), s.eq(e !== t ? e + 1 : 0).addClass("swiper_slide_right")
    }, fLocationClick: function () {
        $("#basicCostList .swiper-slide").first().addClass("swiper_slide_active"), $("#basicCostList .swiper-slide").eq(1).addClass("swiper_slide_right"), $("#basicCostList .swiper-slide").last(0).addClass("swiper_slide_left");
        var e = this;
        $("#basicCostList").on("click", ".swiper_slide_left,.swiper-button-prev", function () {
            e.fMultipleRotation(-1)
        }).on("click", ".swiper_slide_right,.swiper-button-next", function () {
            e.fMultipleRotation(1)
        })
    }, fTabSwitch: function () {
        for (var t = $(".intro__leftCon li"), o = $(".intro__rightCon .intro__item"), e = 0; e < t.length; e++) t[e].index = e, t[e].onclick = function () {
            for (var e = 0; e < t.length; e++) t[e].className = "";
            for (var s = 0; s < o.length; s++) o[s].style.display = "none";
            t[this.index].className = "active", o[this.index].style.display = "block"
        }
    }, fNationalSite: function () {
        var e, s = this;
        $(".jsWebSiteTabs li").on("click", function () {
            e = $(this).find("a").html(), $(".jsWebSiteTabs li").removeClass("active"), $(this).addClass("active"), s.fWebSite(e)
        })
    }, fWebSite: function (s) {
        var t = "";
        allWebSite.map(function (e) {
            e.region == s && e.list.map(function (e) {
                t += "<li><h3>".concat(e.store_name, "</h3><p>").concat(e.address, "</p></li>")
            })
        }), $("#ulist ul").html(t)
    }, fProblemTab: function () {
        $(".customer .question,.aunt .question").click(function () {
            $(this).parent().find(".answer").toggle(), $(this).children().hasClass("foldUp") ? $(this).children(".foldBtn").toggleClass("foldDown") : $(this).children(".foldBtn").toggleClass("foldUp")
        })
    }, fProblemLeftTab: function () {
        for (var t = $("#mainProblem li"), o = $(".item_problem"), e = 0; e < t.length; e++) t[e].index = e, t[e].onclick = function () {
            for (var e = 0; e < t.length; e++) t[e].className = "";
            for (var s = 0; s < o.length; s++) o[s].style.display = "none";
            t[this.index].className = "active", o[this.index].style.display = "block"
        }
    }, fFreeConsult: function () {
        var e = {};
        e.phone = $("#mf_shouji").val(), e.details = "咨询、预约好孕妈妈的服务";
        return "" == e.phone ? (alert("手机号不能为空"), $("#mf_shouji").focus(), !1) : /^0{0,1}(13[0-9]|15[0-9]|17[0-9]|18[0-9])[0-9]{8}$/.test(e.phone) ? void $.post($("footer").attr("host") + "/news/v1/newsopinion", JSON.stringify(e), function (e) {
            0 == e.errcode ? (alert("您已申请成功，我们会有专业的母婴顾问与您联系，请保持电话畅通！"), $(".tel #mf_shouji").val("")) : alert("提交信息失败。")
        }) : (alert("手机号码格式不正确！"), $("#mf_shouji").focus(), !1)
    }
};
common.init();